//package com.hyphenate.easeui.widget;
//
//import android.app.Activity;
//import android.content.Context;
//import android.content.res.TypedArray;
//import android.graphics.drawable.Drawable;
//import android.os.Build;
//import android.util.AttributeSet;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.ImageView;
//import android.widget.RelativeLayout;
//import android.widget.TextView;
//
//import com.hyphenate.easeui.R;
//import com.paishen.common.util.BaseUtil;
//
///**
// * 标题栏
// *
// */
//public class EaseTitleBar extends RelativeLayout{
//
//    protected RelativeLayout leftLayout;
//    protected ImageView leftImage;
//    protected RelativeLayout rightLayout;
//    protected ImageView rightImage;
//    protected TextView titleView;
//    protected RelativeLayout titleLayout;
//
//    public EaseTitleBar(Context context) {
//        this(context, null);
//    }
//    public EaseTitleBar(Context context, AttributeSet attrs) {
//        super(context, attrs);
//        init(context, attrs);
//
//        int top4_4 = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? BaseUtil.getStatusBarHeight() : 0);
//        titleLayout.setLayoutParams(new ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) getResources().getDimension(R.dimen.height_top_bar) + top4_4));
//        titleLayout.setPadding(0, top4_4, 0, 0);
//
//        if(BaseUtil.setStatusBarDarkMode(true, (Activity)getContext())) {
//            setBackgroundColor(0xFFFFFFFF);
//        }
//    }
//
//
//
//    private void init(Context context, AttributeSet attrs){
//        LayoutInflater.from(context).inflate(R.layout.ease_widget_title_bar, this);
//        leftLayout = (RelativeLayout) findViewById(R.id.left_layout);
//        leftImage = (ImageView) findViewById(R.id.left_image);
//        rightLayout = (RelativeLayout) findViewById(R.id.right_layout);
//        rightImage = (ImageView) findViewById(R.id.right_image);
//        titleView = (TextView) findViewById(R.id.title);
//        titleLayout = (RelativeLayout) findViewById(R.id.title_container);
//
//        parseStyle(context, attrs);
//    }
//
//    private void parseStyle(Context context, AttributeSet attrs){
//        if(attrs != null){
//            TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.EaseTitleBar);
//            String title = ta.getString(R.styleable.EaseTitleBar_titleBarTitle);
//            titleView.setText(title);
//
//            Drawable leftDrawable = ta.getDrawable(R.styleable.EaseTitleBar_titleBarLeftImage);
//            if (null != leftDrawable) {
//                leftImage.setImageDrawable(leftDrawable);
//            }
//            Drawable rightDrawable = ta.getDrawable(R.styleable.EaseTitleBar_titleBarRightImage);
//            if (null != rightDrawable) {
//                rightImage.setImageDrawable(rightDrawable);
//            }
//
//            Drawable background = ta.getDrawable(R.styleable.EaseTitleBar_titleBarBackground);
//            if(null != background) {
//                titleLayout.setBackgroundDrawable(background);
//            }
//
//            ta.recycle();
//        }
//    }
//
//    public void setLeftImageResource(int resId) {
//        leftImage.setImageResource(resId);
//    }
//
//    public void setRightImageResource(int resId) {
//        rightImage.setImageResource(resId);
//    }
//
//    public void setLeftLayoutClickListener(OnClickListener listener){
//        leftLayout.setOnClickListener(listener);
//    }
//
//    public void setRightLayoutClickListener(OnClickListener listener){
//        rightLayout.setOnClickListener(listener);
//    }
//
//    public void setLeftLayoutVisibility(int visibility){
//        leftLayout.setVisibility(visibility);
//    }
//
//    public void setRightLayoutVisibility(int visibility){
//        rightLayout.setVisibility(visibility);
//    }
//
//    public void setTitle(String title){
//        titleView.setText(title);
//    }
//
//    public void setBackgroundColor(int color){
//        titleLayout.setBackgroundColor(color);
//    }
//
//    public RelativeLayout getLeftLayout(){
//        return leftLayout;
//    }
//
//    public RelativeLayout getRightLayout(){
//        return rightLayout;
//    }
//}
